var v = new Vue({
	el:"#finished",
	data:{
		vdata:{},
        money:{}
	},
	methods:{
		getList: function() {
            var _this = this;
            $.get(
                "/index.php/Order/getFinished",
                function(ret) {
                    if (ret.status == "success") {
                        _this.vdata = ret.data.data;
                        //console.log( ret.data);
                        var show=1;
                        if(ret.data.totalPage < 5){
                                    show = ret.data.totalPage;
                                }else{
                                    show = 5;
                                }
                        $(".page").twbsPagination({
                                totalPages: ret.data.totalPage,
                                visiblePages: show,
                                onPageClick: function(event, page) {
                                    $.post(
                                        "/index.php/Order/getFinished", {
                                            page: page
                                        },
                                        function(reg) {
                                            if(reg.status == "success"){
                                                _this.vdata = reg.data.data;
                                            }
                                        }
                                    );
                                }
                            });
                    } else {
                        layer.msg("还没有记录!",{icon:2});
                    }
                }
            );
        },
        getSales:function(){
            var _this = this;
            $.get(
                "/index.php/Order/getSales",
                function(ret) {
                    if (ret.status == "success") {
                        _this.money = ret.data;
                        //console.log(_this.MoneyInfo.amount);
                    } else {
                        layer.msg("还没有记录!",{icon:2});
                    }
                }
            );
        }
	},
	ready: function() {
        this.getList();
        this.getSales();
    }
});